查看GitHub仓库大小的几种方法

您所在的位置:网站首页 github 仓库限制 查看GitHub仓库大小的几种方法

查看GitHub仓库大小的几种方法

2024-07-17 23:50:23| 来源: 网络整理| 查看: 265

GitHub在默认情况下是不显示仓库大小的,那如果我们要怎样才能查看一个仓库的大小?这篇文章介绍几种方法来实现该功能,总有一种适合你。需要注意的是这里要区分公开仓库和私有仓库。

一、GitHub自带查看仓库大小的功能(public、private)

因为这是自带功能,所以公开仓库和私有仓库都可以查看大小。

(以下内容转自:https://blog.csdn.net/i042416/article/details/86666843) 其实github上提供了非常方便的工具供我们查看。

步骤

1.登录github网页首页,选择自己账户的settings:在这里插入图片描述

2.点击repository:在这里插入图片描述

3.这里就有每个repository对应的存储空间大小:在这里插入图片描述

二、利用GitHub提供的API查看(public)

只要访问指定网址,即可参看仓库大小,;所以只能访问公开仓库的信息。

语法:https://api.github.com/repos/user/repo,访问后得到一个包含仓库信息(user为用户名,repo为仓库名)的json数据。

如,我的第一个仓库:https://api.github.com/repos/yansheng836/hello-world

json数据如下:我们可以看到内容很丰富,其中的size就是仓库大小,单位是kb,其他内容有兴趣也可以了解下。

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102{ "id": 159042524, "node_id": "MDEwOlJlcG9zaXRvcnkxNTkwNDI1MjQ=", "name": "hello-world", "full_name": "yansheng836/hello-world", "private": false, "owner": { "login": "yansheng836", "id": 45334066, "node_id": "MDQ6VXNlcjQ1MzM0MDY2", "avatar_url": "https://avatars0.githubusercontent.com/u/45334066?v=4", "gravatar_id": "", "url": "https://api.github.com/users/yansheng836", "html_url": "https://github.com/yansheng836", "followers_url": "https://api.github.com/users/yansheng836/followers", "following_url": "https://api.github.com/users/yansheng836/following{/other_user}", "gists_url": "https://api.github.com/users/yansheng836/gists{/gist_id}", "starred_url": "https://api.github.com/users/yansheng836/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/yansheng836/subscriptions", "organizations_url": "https://api.github.com/users/yansheng836/orgs", "repos_url": "https://api.github.com/users/yansheng836/repos", "events_url": "https://api.github.com/users/yansheng836/events{/privacy}", "received_events_url": "https://api.github.com/users/yansheng836/received_events", "type": "User", "site_admin": false }, "html_url": "https://github.com/yansheng836/hello-world", "description": ":smiley:My first repository. ", "fork": false, "url": "https://api.github.com/repos/yansheng836/hello-world", "forks_url": "https://api.github.com/repos/yansheng836/hello-world/forks", "keys_url": "https://api.github.com/repos/yansheng836/hello-world/keys{/key_id}", "collaborators_url": "https://api.github.com/repos/yansheng836/hello-world/collaborators{/collaborator}", "teams_url": "https://api.github.com/repos/yansheng836/hello-world/teams", "hooks_url": "https://api.github.com/repos/yansheng836/hello-world/hooks", "issue_events_url": "https://api.github.com/repos/yansheng836/hello-world/issues/events{/number}", "events_url": "https://api.github.com/repos/yansheng836/hello-world/events", "assignees_url": "https://api.github.com/repos/yansheng836/hello-world/assignees{/user}", "branches_url": "https://api.github.com/repos/yansheng836/hello-world/branches{/branch}", "tags_url": "https://api.github.com/repos/yansheng836/hello-world/tags", "blobs_url": "https://api.github.com/repos/yansheng836/hello-world/git/blobs{/sha}", "git_tags_url": "https://api.github.com/repos/yansheng836/hello-world/git/tags{/sha}", "git_refs_url": "https://api.github.com/repos/yansheng836/hello-world/git/refs{/sha}", "trees_url": "https://api.github.com/repos/yansheng836/hello-world/git/trees{/sha}", "statuses_url": "https://api.github.com/repos/yansheng836/hello-world/statuses/{sha}", "languages_url": "https://api.github.com/repos/yansheng836/hello-world/languages", "stargazers_url": "https://api.github.com/repos/yansheng836/hello-world/stargazers", "contributors_url": "https://api.github.com/repos/yansheng836/hello-world/contributors", "subscribers_url": "https://api.github.com/repos/yansheng836/hello-world/subscribers", "subscription_url": "https://api.github.com/repos/yansheng836/hello-world/subscription", "commits_url": "https://api.github.com/repos/yansheng836/hello-world/commits{/sha}", "git_commits_url": "https://api.github.com/repos/yansheng836/hello-world/git/commits{/sha}", "comments_url": "https://api.github.com/repos/yansheng836/hello-world/comments{/number}", "issue_comment_url": "https://api.github.com/repos/yansheng836/hello-world/issues/comments{/number}", "contents_url": "https://api.github.com/repos/yansheng836/hello-world/contents/{+path}", "compare_url": "https://api.github.com/repos/yansheng836/hello-world/compare/{base}...{head}", "merges_url": "https://api.github.com/repos/yansheng836/hello-world/merges", "archive_url": "https://api.github.com/repos/yansheng836/hello-world/{archive_format}{/ref}", "downloads_url": "https://api.github.com/repos/yansheng836/hello-world/downloads", "issues_url": "https://api.github.com/repos/yansheng836/hello-world/issues{/number}", "pulls_url": "https://api.github.com/repos/yansheng836/hello-world/pulls{/number}", "milestones_url": "https://api.github.com/repos/yansheng836/hello-world/milestones{/number}", "notifications_url": "https://api.github.com/repos/yansheng836/hello-world/notifications{?since,all,participating}", "labels_url": "https://api.github.com/repos/yansheng836/hello-world/labels{/name}", "releases_url": "https://api.github.com/repos/yansheng836/hello-world/releases{/id}", "deployments_url": "https://api.github.com/repos/yansheng836/hello-world/deployments", "created_at": "2018-11-25T14:52:04Z", "updated_at": "2019-09-22T12:27:48Z", "pushed_at": "2019-09-07T05:34:18Z", "git_url": "git://github.com/yansheng836/hello-world.git", "ssh_url": "[email protected]:yansheng836/hello-world.git", "clone_url": "https://github.com/yansheng836/hello-world.git", "svn_url": "https://github.com/yansheng836/hello-world", "homepage": "https://yansheng836.github.io/hello-world/", "size": 157, "stargazers_count": 0, "watchers_count": 0, "language": "C++", "has_issues": true, "has_projects": true, "has_downloads": true, "has_wiki": true, "has_pages": true, "forks_count": 0, "mirror_url": null, "archived": false, "disabled": false, "open_issues_count": 0, "license": { "key": "mit", "name": "MIT License", "spdx_id": "MIT", "url": "https://api.github.com/licenses/mit", "node_id": "MDc6TGljZW5zZTEz" }, "forks": 0, "open_issues": 0, "watchers": 0, "default_branch": "master", "network_count": 0, "subscribers_count": 1} 三、利用浏览器插件:Enhanced GitHub(public、private)

该插件在GitHub上开源:https://github.com/softvar/enhanced-github

Google商店网址:https://chrome.google.com/webstore/detail/enhanced-github/anlikcnbgdeidpacdbdljnabclhahhmd

下面是官方介绍:

概述

显示仓库大小,每个文件的大小,下载链接和复制文件内容的选项,在GitHub网站顶部提供有用功能的扩展。

特征

1.显示仓库规模。

2.显示每个活动分支中的每个文件大小(不适用于文件夹/符号链接)

3.显示每个文件的下载链接(不适用于文件夹/符号链接)

4.直接将文件内容复制到剪贴板(对于markdown文件不起作用)

5.在查看文件内容的同时下载文件。

7.即将推出…请在https://github.com/softvar/enhanced-github/issues上打开一个问题以提出建议

注意:从v1.0.0开始-由于GitHub已停止直接下载文件,因此在按Alt / Cmd(对于Mac)/ Ctrl(对于Windows)时单击下载图标/按钮。

它是开源的-根据MIT许可证 https://github.com/softvar/enhanced-github

注意:私有仓库需要添加Token

该插件适用于公开和私有仓库,但是私有仓库需要添加token,不然因为权限不够,会访问不了。

添加token步骤:(详情可见:https://github.com/softvar/enhanced-github#github-api-rate-limiting)

1.先到 https://github.com/settings/tokens ,点击“Generate new token”,范围勾选repo就可以了(如下),拉到最下面,点击“Generatetoken”申请一个token。

2.复制token,然后(右键)点击该插件,选择“选项”,跳转后,等一会儿(10s左右),会弹出如下弹窗,将复制的token填进去,然后去访问一个自己的私有仓库就可以显示大小。

补充:该插件的另一个很棒的功能就是很简单就能下载一个文件(暂时不支持下载文件夹) 本文作者: 荷塘月色 发布时间: 2019-09-23 最后更新: 2019-09-23 本文标题: 查看GitHub仓库大小的几种方法 本文链接: https://yansheng836.github.io/article/45d40d84.html 版权声明: 本作品采用 CC BY-NC-SA 4.0 许可协议进行许可。转载请注明出处! 知识共享许可协议

谢谢你请我吃糖果

支付宝 微信


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭